<?php

namespace App\Models\Activity;

use Illuminate\Database\Eloquent\Model;

use Carbon\Carbon;

class StoreGiftPartake extends Model
{

    protected $table = 'store_gift_partake';

    protected $primaryKey = 'id';

    public $timestamps = false;

    public $incrementing = false;

    //获取用户参与记录
    public static function getPartake( $pcustID , $activity_id ) {
        return self::where([ 'activity_id' => $activity_id,'pcustID' => $pcustID ])->first();
    }

    //保存参与记录
    public static function savePartake( $activity_id , $pcustID , $custID , $code , $message ) {
        self::insert([
            'uuid' => makeUuid(),
            'timeStamp' => Carbon::now(),
            'creator' => 'system',
            'createTime' => Carbon::now(),
            'activity_id' => $activity_id,
            'pcustID' => $pcustID,
            'custID' => $custID,
            'status_code' => $code,
            'msg' => $message,
        ]);
    }


}